Base class for resource managers. More...
Public Member Functions | |
| T * | createOrRetrieve (nkMemory::StringView name) |
| T * | record (nkMemory::StringView name, nkMemory::UniquePtr< T > resource) |
| T * | get (nkMemory::StringView name) const |
| T * | getByIndex (unsigned int index) const |
| void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
| void | erase (nkMemory::StringView name) |
| nkMemory::UniquePtr< T > | relinquish (nkMemory::StringView name) |
Base class for resource managers.
| T* nkGraphics::Manager< T >::createOrRetrieve | ( | nkMemory::StringView | name | ) |
Creates (if unavailable) or retrieves (if available) a resource attached to passed name.
| name | The name, aka identifier, of the resource to create or retrieve. |
| T* nkGraphics::Manager< T >::record | ( | nkMemory::StringView | name, |
| nkMemory::UniquePtr< T > | resource | ||
| ) |
Records an already existing resource in the manager, passing its ownership around.
| name | The name under which the resource should be recorded. |
| resource | The resource to record. |
| T* nkGraphics::Manager< T >::get | ( | nkMemory::StringView | name | ) | const |
Returns a resource attached to a name, if available.
| name | The name of the resource that should be retrieved. |
| T* nkGraphics::Manager< T >::getByIndex | ( | unsigned int | index | ) | const |
Returns the resource at given index, if available.
| index | The index of the resource to retrieve. |
| void nkGraphics::Manager< T >::rename | ( | nkMemory::StringView | currentName, |
| nkMemory::StringView | newName | ||
| ) |
Renames a resource.
| currentName | The name of the resource to rename. |
| newName | The name to reassign to the resource. |
| void nkGraphics::Manager< T >::erase | ( | nkMemory::StringView | name | ) |
Erases a resource. Memory attached to it will be freed.
| name | The name identifying the resource to erase. |
| nkMemory::UniquePtr<T> nkGraphics::Manager< T >::relinquish | ( | nkMemory::StringView | name | ) |
Requests the manager to relinquish the ownership of a resource and pass it around.
| name | The name of the recorded resource to relinquish. |